package pe.edu.cibertec.listener;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.PostLoad;
import javax.persistence.PostPersist;
import javax.persistence.PostRemove;
import javax.persistence.PostUpdate;
import javax.persistence.PrePersist;
import javax.persistence.PreRemove;
import javax.persistence.PreUpdate;

/**
 *
 * @author portatil
 */
public class MonitoreoListener {

    private static Logger logger = Logger.getLogger(MonitoreoListener.class.getName());

    @PrePersist
    public void prePersist(Object object) {
        logger.log(Level.INFO, "ENTITY LISTENER: Luego de invocar método persist() ");
    }

    @PostPersist
    public void postPersist(Object object) {
        logger.log(Level.INFO, "ENTITY LISTENER: Luego de enviar  INSERT  a BD ");
    }

    @PreUpdate
    public void preUpdate(Object object) {
        logger.log(Level.INFO, "ENTITY LISTENER: Instante antes de enviar UPDATE a BD");
    }

    @PostUpdate
    public void postUpdate(Object object) {
        logger.log(Level.INFO, "ENTITY LISTENER: Luego de enviar  UPDATE  a BD ");
    }

    @PreRemove
    public void preRemove(Object object) {
        logger.log(Level.INFO, "ENTITY LISTENER: Luego de invocar método remove() ");
    }

    @PostRemove
    public void postRemove(Object object) {
        logger.log(Level.INFO, "ENTITY LISTENER: Luego de enviar DELETE  a BD ");
    }

    @PostLoad
    public void postLoad(Object object) {
        logger.log(Level.INFO, "ENTITY LISTENER: Post Load ");
    }
}
